package 练习;

import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Arrays;



public class t10 {
    public static void main(String[] args) throws ClassNotFoundException, NoSuchFieldException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException {
        Class a = Class.forName("练习.t8");
        System.out.println(a.getName());
        System.out.println(a.getSimpleName());
        System.out.println(a.getSuperclass());
        System.out.println(java.lang.reflect.Modifier.toString(a.getModifiers()));
        System.out.println(Arrays.toString(a.getInterfaces()));
        System.out.println(Arrays.toString(a.getFields()));
        System.out.println(Arrays.toString(a.getDeclaredFields()));
        System.out.println(a.getField("name"));
        System.out.println(a.getDeclaredField("yin3"));
        Method[] methods = a.getMethods();
        Method[] methods2 = a.getDeclaredMethods();
        Constructor[] constructors = a.getConstructors();
        Constructor cc = a.getConstructor();
        Constructor dd = a.getConstructor(int.class);
        System.out.println(cc);
        System.out.println(dd);
        System.out.println(Arrays.toString(constructors));
        t8 t = (t8) dd.newInstance(11);
        Method mm = a.getMethod("itt");
        mm.invoke(t);
        for(Method m:methods){
            System.out.println(m.getName());
//            System.out.println(Arrays.toString(m.getParameters()));
//            System.out.println(Arrays.toString(m.getExceptionTypes()));
        }
        for(Method m :methods2){
            System.out.println(m.getName());
        }
    }
}
